package com.chen.demo.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;


import java.util.List;

/**
 * @author Y·C
 * @version 1.0.0
 * @ClassName Author.java
 * @Description TODO
 * @createTime 2023年04月26日 21:49:00
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode //用户后期的去重使用
public class Author implements Comparable<Author> {

    //id
    private Long id;
    //姓名
    private String name;
    //年龄
    private Integer age;
    //简介
    private String intro;
    //作品
    private List<Book> books;

    @Override
    public int compareTo(Author o) {
        return o.getAge()-this.getAge();
    }
}
